
#include <BFont>
#include <BWidget>
#include "member_BLineEdit.h"

using namespace BWE;

member_BLineEdit::member_BLineEdit(BLineEdit* edit)
{
	boss = edit;
	readOnly = false;
	blinkTime = 500;
	blinkTick = 0;
	changed = false;
	pressed = false;
	align = Align_Left | Align_VCenter;
	hoverIndex = 0;
	inputIndex = 0;
	inputCount = 0;
	inputShown = false;
	dirty = true;
}
member_BLineEdit::~member_BLineEdit()
{

}

void member_BLineEdit::freahText()
{
	text.reset();
	for (int bi = 0; bi < cells.size(); bi++)
	{
		text.append(cells[bi].code);
	}
}

void member_BLineEdit::freshRects()
{
	const BFont* font = boss->font();
	if (!font)
		return;

	BRect crect = boss->clientRect();

	this->adjust();

	rect = crect.align(align, rect.size());

	if (inputIndex < 0)
		inputIndex = 0;
	if (inputIndex > cells.size())
		inputIndex = cells.size();
}
